# coding = utf-8

import time


def timer(func):
    def deco(*args, **kwargs):
        start_time = time.time()
        func(*args, **kwargs)
        end_time = time.time()
        print("the runtime is %s" % (end_time - start_time))
    # deco()
    return deco  # 有个疑问，这个地方是deco没执行然后在return的时候才执行的么？


def test1():
    time.sleep(3)
    print("this is test1")


# @timer
def test2(name, sex):
    time.sleep(3)
    print("this is test2", name, sex)


A = timer(test1)
A()
print(A)

# test2("akes", "sdad")
B = timer(test2)
B("akes", "sdad")
